package us.norepeter.processing.textmatcher.names;

import java.text.Normalizer;
import java.text.Normalizer.Form;

import us.norepeter.processing.textmatcher.AbstractTransformer;

public class DiacriticalCharacterTransformer extends AbstractTransformer {

	DiacriticalCharacterTransformer() {
		super("DiacriticalCharacterTransformer");
	}

	@Override
	public String transform(String s) {
		return removeDiacriticalMarks(s);
	}
	
	public static String removeDiacriticalMarks(String string) {
	    return Normalizer.normalize(string, Form.NFD)
	        .replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
	}
}
